<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 300px;
            height: 200px;
            border: 1px solid #000;
            box-sizing: border-box;
            margin: 200px auto;
            /*
            默认情况下会从上到下的渐变
                        background: linear-gradient(red,green);
                        从下到上的渐变
                           background: linear-gradient(to top ,red,green);
                        从左到右
                                    background: linear-gradient(to right ,red,green);
                        从右到左
                                    background: linear-gradient(to left ,red,green);
                        从左下到右上
                        background: linear-gradient(to top right ,red,green);

                        通过度数来设置

                         background: linear-gradient(90deg ,red,green);


            */
            background: linear-gradient(90deg ,red,green);
        }
    </style>
</head>
<body>

<div></div>

</body>
</html>